package enemies;

import game.Constants;

import java.awt.event.ActionEvent;
import java.util.ArrayList;

import Missiles.*;

public class Slower extends StrongEnemy
{		
	public Slower(int initX, ArrayList<Missile> m) //it does not fly vertically
	{
		super(initX, 100, m);
		setImage(SLOWER);
		if (initX == 1)  //it flies from left to right
			dx = 6;
		else dx = -6; //initX = MAIN_WIDTH
		dy = 1;
	}
	
	public void actionPerformed(ActionEvent e)  //it fires missiles
	{	
		SpeedDrop sd = new SpeedDrop(getX() + width/2, getY() + height, -1);
		sd.setImage(SPEED_DEBUFF);
		enemyMissiles.add(sd);
	}
	
    public void act() {
        y = y + dy;
        x = x + dx;
        if ((getX() <= 0) || (getX() >= MAIN_WIDTH))
        {
        	die();
        	timer.stop();
        }
    }
}
